<?php

function URI($url){
	return $url;
} 

//公共分页
function MyPage($total,$num=10,$url=''){
	$p = new \Page($total, $num);
	$p->setConfig('header', '条数据');
	$p->url = $url; 
	$page = $p->show();            //分页的导航条的输出变量	 
	$res = array(
				"firstRow"=>$p->firstRow,
				"listRows"=>$p->listRows,
				"page"=>$page
		   );
	return $res;   
}

function TimeToTxt($time)
{
   //获取今天凌晨的时间戳
   $day = strtotime(date('Y-m-d',time()));
   //获取昨天凌晨的时间戳
   $pday = strtotime(date('Y-m-d',strtotime('-1 day')));
   //获取现在的时间戳
   $nowtime = time();
    
   $tc = $nowtime-$time;
   if($time<$pday){
      $str = date('Y-m-d',$time);
   }elseif($time<$day && $time>$pday){
      $str = "昨天";
   }elseif($tc>60*60){
      $str = floor($tc/(60*60))."小时前";
   }elseif($tc>60){
      $str = floor($tc/60)."分钟前";
   }else{
      $str = "刚刚";
   }
   return $str;
}